home *** CD-ROM | disk | FTP | other *** search
/ ETO Development Tools 4 / ETO Development Tools 4.iso / Tools - Objects / MPW C++ / MPW C++ 3.1 / Examples / CPlusExamples / TEDocument.h < prev    next >
Text File  |  1990-09-11  |  3KB  |  104 lines

  1. /*------------------------------------------------------------------------------
  2. #
  3. #    Apple Macintosh Developer Technical Support
  4. #
  5. #    MultiFinder-Aware Simple TextEdit Sample Application
  6. #
  7. #    CPlusTESample
  8. #
  9. #    TEDocument.h    -    C++ source
  10. #
  11. #    Copyright © 1989 Apple Computer, Inc.
  12. #    All rights reserved.
  13. #
  14. #    Versions:    
  15. #            1.10                     07/89
  16. #            1.00                     04/89
  17. #
  18. #    Components:
  19. #            CPlusTESample.make        July 9, 1989
  20. #            TApplicationCommon.h    July 9, 1989
  21. #            TApplication.h            July 9, 1989
  22. #            TDocument.h                July 9, 1989
  23. #            TECommon.h                July 9, 1989
  24. #            TESample.h                July 9, 1989
  25. #            TEDocument.h            July 9, 1989
  26. #            TApplication.cp            July 9, 1989
  27. #            TDocument.cp            July 9, 1989
  28. #            TESample.cp                July 9, 1989
  29. #            TEDocument.cp            July 9, 1989
  30. #            TESampleGlue.a            July 9, 1989
  31. #            TApplication.r            July 9, 1989
  32. #            TESample.r                July 9, 1989
  33. #
  34. #    CPlusTESample is an example application that demonstrates
  35. #    how to initialize the commonly used toolbox managers,
  36. #    operate successfully under MultiFinder, handle desk
  37. #    accessories and create, grow, and zoom windows. The
  38. #    fundamental TextEdit toolbox calls and TextEdit autoscroll
  39. #    are demonstrated. It also shows how to create and maintain
  40. #    scrollbar controls. 
  41. #
  42. #    This version of TESample has been substantially reworked in
  43. #    C++ to show how a "typical" object oriented program could
  44. #    be written. To this end, what was once a single source code
  45. #    file has been restructured into a set of classes which
  46. #    demonstrate the advantages of object-oriented programming.
  47. #
  48. ------------------------------------------------------------------------------*/
  49.  
  50. #ifndef TEDocument_Defs
  51. #define TEDocument_Defs
  52.  
  53. #include <Types.h>
  54. #include <TextEdit.h>
  55. #include <Controls.h>
  56. #include <Events.h>
  57.  
  58. #include "TDocument.h"
  59.  
  60. class TEDocument : public TDocument {
  61.  
  62.     TEHandle        fDocTE;            // our text
  63.     ControlHandle    fDocVScroll;    // vertical scrollbar
  64.     ControlHandle    fDocHScroll;    // horizontal scrollbar
  65.     ClikLoopProcPtr    fDocClik;        // our clik loop
  66.  
  67.     // methods not intended for use outside of this class
  68.     void GetTERect(Rect *teRect);
  69.     void AdjustTE(void);
  70.     void DrawWindow(void);
  71.     void AdjustViewRect(void);
  72.     void ResizeWindow(void);
  73.     void AdjustHV(Boolean isVert,Boolean mustRedraw);
  74.     void AdjustScrollSizes(void);
  75.     void AdjustScrollbars(Boolean needsResize);
  76.  
  77. public:
  78.     TEDocument(short resID);
  79.     ~TEDocument(void);
  80.  
  81.     // methods from TDocument we override
  82.     void DoZoom(short partCode);
  83.     void DoGrow(EventRecord* theEvent);
  84.     void DoContent(EventRecord* theEvent);
  85.     void DoKeyDown(EventRecord* theEvent);
  86.     void DoActivate(Boolean becomingActive);
  87.     void DoIdle(void);
  88.     void DoUpdate(void);
  89.     void DoCut(void);
  90.     void DoCopy(void);
  91.     void DoPaste(void);
  92.     void DoClear(void);
  93.     unsigned long CalcIdle(void);
  94.     Boolean HaveSelection(void);
  95.  
  96.     // new public methods
  97.     void AdjustScrollValues(Boolean mustRedraw);
  98.     ClikLoopProcPtr GetClikLoop(void);
  99.     TEHandle GetTEHandle(void);
  100.     void GetVisTERgn(RgnHandle rgn);
  101. };
  102.  
  103. #endif TEDocument_Defs
  104.